package com.ctgu.computer.mapper;

import com.ctgu.computer.annotation.FillNowTime;
import com.ctgu.computer.domain.dto.NoticeAddDTO;
import com.ctgu.computer.domain.dto.NoticePageDTO;
import com.ctgu.computer.domain.po.NoticeInfo;
import com.ctgu.computer.domain.vo.NoticeVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface NoticeMapper {
    @FillNowTime
    void insert(NoticeInfo noticeInfo);

    Page<NoticeVO> page(NoticePageDTO noticePageDTO);

    @Select("select * from notice_info where admin_id = #{adminId}")
    List<NoticeInfo> selectByAdminId(Integer adminId);

    @Select("select * from notice_info where notice_id = #{noticeId}")
    NoticeInfo selectByNoticeId(Integer noticeId);

    @Delete("delete from notice_info where notice_id = #{noticeId}")
    void deleteByNoticeId(Integer noticeId);

    void updateById(NoticeAddDTO noticeAddDTO);
}
